<?php
	// build nav links here
		
	$tributesURL = "/index.php/index/admintributes";
	$adminsURL = "/index.php/index/administrators";
//	$settingsURL = "/index.php/index/funeralhomemerchandise";
	$acctURL = "/index.php/index/adminprofile";
	$faqURL = "/index.php/index/administratorhelphelp";
	$homeURL = "/index.php/index/admindashboard";
	$logoutURL = "/index.php/index/logout";
	
	$acctHREF = "<a class=\"menuLinks\" href='$acctURL'>My Account</a>";
	$faqHREF = "<a class=\"menuLinks\" href='$faqURL'>Help/FAQ</a>";
	$homeHREF = "<h1><a class=\"menuLinks\" href='$homeURL'>Dashboard</a></h1>";
	$adminsHREF = "<a class=\"menuLinks\" href='$adminsURL'>Admin Management</a>";
	$tributesHREF = "<a class=\"menuLinks\" href='$tributesURL'>Tribute Packages</a>";
//	$settingsHREF = "<a class=\"menuLinks\" href='$settingsURL'>Settings</a>";
	$logoffHREF = "<a class=\"menuLinks\" href='$logoutURL'>Log Out</a>";
	$logoutHREF = "<a id=\"btnLogout\" href='$logoutURL'>Log Out</a>";
		
	$urlBAR = "$acctHREF&nbsp;&#124;&nbsp;$adminsHREF&nbsp;&#124;&nbsp;$tributesHREF&nbsp;&#124;&nbsp;$logoffHREF";

	$admin_profile = $this->user_profile;
	$admin_name = $admin_profile['fname'];
	if(!empty($admin_profile['mname'])) 
		$admin_name .= " ".$admin_profile['mname'];
	$admin_name .= " ".$admin_profile['lname'];
?>
<?php echo  $this->doctype(Zend_View_Helper_Doctype::XHTML1_TRANSITIONAL)."\n"; ?>
<html>
<head>
  <?php echo  $this->headTitle('Keystone VAS Administrator'); ?>
  
	<style type="text/css">
		@import "/js/dijit/themes/tundra/tundra.css";
		@import "/js/dojox/grid/resources/tundraGrid.css";
		@import "/js/dojox/form/resources/DropDownSelect.css";
		/*@import "/css/keystoneadmin.css";*/
		@import "/css/dashboard.css";
		@import "/css/sidebar.css";
	</style>

    <script>
    	djConfig = { isDebug:false, parseOnLoad:true };
    </script>

  <?php
      // grab the JS for this page
    $this->headScript()->appendFile( JS_BASE."/dojo/dojo.js");    

    if($this->pageName=="DASHBOARD")
        $this->headScript()->appendFile( JS_BASE."/keystoneadmingrids.js" )."\n";
  	else
  	if($this->pageName=="MODULEEDITOR")
  		$this->headScript()->appendFile( JS_BASE."/module_editor.js" )."\n";
  	else
  	if($this->pageName=="TRIBUTEPACKAGES")
  		$this->headScript()->appendFile( JS_BASE."/tributes.js" )."\n";
  	else
  	if($this->pageName=="LOCALEMERCHANDISE")
  	{
		// $this->catalog ---> $catalog_items_str
		$catalog_items = array();
		foreach($this->catalog as $catalog_item)
		{
			$FDMS_id = $catalog_item['price_list_id'];
			$descr = $catalog_item['item_description'];
			$price = $catalog_item['item_amount'];
			$category = $catalog_item['item_category'];
			
			$item_str = "{";
			$item_str .= "id:$FDMS_id, ";
			$item_str .= "category:'$category', ";
			$item_str .= "name:'$descr', ";
			$item_str .= "price:$price ";
			$item_str .= "}";

			$catalog_items[] = $item_str;
		}
		$catalog_items_str = implode( ", ", $catalog_items );
		
		$cart_items = array();
		foreach($this->cart as $cart_item)
		{
			$FDMS_id = $cart_item['price_list_id'];
			$descr = $cart_item['item_name'];
			$price = $cart_item['item_price'];
			$category = $cart_item['item_category'];
			$picture = $cart_item['picture'];
			
			$item_str = "{";
			$item_str .= "id:$FDMS_id, ";
			$item_str .= "category:'$category', ";
			$item_str .= "name:'$descr', ";
			$item_str .= "price:$price,";
			$item_str .= "picture:'$picture' ";
			$item_str .= "}";

			$cart_items[] = $item_str;
		}
		$cart_items_str = implode( ", ", $cart_items );

	    echo "<script type=\"text/javascript\">\n";

   		echo "var catalogArray =  {\n";
        echo "  identifier: 'id',\n";
		echo "	label: 'id',\n";
		echo "	items: [ $catalog_items_str ]\n";
        echo "};\n";

   		echo "var featuredArray =  {\n";
        echo "  identifier: 'id',\n";
		echo "	label: 'id',\n";
		echo "	items: [ $cart_items_str ]\n";
        echo "};\n";

	    echo "</script>\n";

  		$this->headScript()->appendFile( JS_BASE."/featured_merchandise.js" )."\n";
  	}
  		
    echo $this->headScript();
    
    ?>
    
</head>
<body class="admin">
<div id="page">
 	<!-- page header -->
 	<div id="header">

 		<!-- basic keystone header plus admin name -->
		<div id="logo"><img src="<?php echo ART_BASE?>/keystone_logo2.jpg"></div>
		<div id="info">Keystone Group Holdings, Inc.<br><h1>Virtual Arrangement System</h1></div>
		<br clear="all">
		<div id="who">Welcome, <?php echo  $admin_name ?> &nbsp;-&nbsp; <?php echo $urlBAR?></div>

 	</div>
 	 	
 	<div id="content">
 	
 		<div id="leftnav"><p>Menu</p><br>
 			<?php echo $homeHREF?>
 		</div>
		
 		<div id="main" class="main">
			<?php echo  $this->layout()->content; ?>
 		</div><br clear="all">
 		
 		<div id="controls" class="main">
 			<?php echo $logoutHREF?>
 		</div><br clear="all">
 	</div>
 	
 	<div id="footer"> Virtual Arrangement System &copy; 2009 Keystone Group Holdings, Inc.
 	</div>

 </div> 
 </body>
</html>
